package com.dailyblue.java.standard.network.bio;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class 客户端 extends Thread {
    private Scanner scanner = new Scanner(System.in);
    @Override
    public void run() {
        try {
            Socket socket = new Socket("localhost", 8899);
            System.out.println("客户端连接成功！");
            // 客户端接收
            InputStream in = socket.getInputStream();
            OutputStream out = socket.getOutputStream();
            new 发送(out,false).start();
            new 接收(in).start();
        } catch (Exception e) {
            System.out.println("1." + e.getMessage());
        }
    }

    public static void main(String[] args) {
        new 客户端().start();
    }
}
